<?php
// +----------------------------------------------------------------------
// | Powered By ThinkPHP 5.0.12
// +----------------------------------------------------------------------
// | Copyright (c) 2017 http://www.bojuwang.net All rights reserved.
// +----------------------------------------------------------------------
// | Date：2017-12
// +----------------------------------------------------------------------
// | Author: ZhengLuwei <512711380@qq.com>
// +----------------------------------------------------------------------

namespace app\admin\controller;

use think\Controller;
use think\Db;
use think\Request;

class Index extends AdminBasic
{
    public function index()
    {

        //订单
        $orderCount = Db::name('goods_order')->where('status',1)->count();
        $this->assign('orderCount',$orderCount);
        $todayOrderCount = Db::name('goods_order') ->whereTime('add_time', 'today')->where('status',1)->count();
        $this->assign('todayOrderCount',$todayOrderCount);
        $yesterdayOrderCount = Db::name('goods_order') ->whereTime('add_time', 'yesterday')->where('status',1)->count();
        $this->assign('yesterdayOrderCount',$yesterdayOrderCount);
        $weekOrderCount = Db::name('goods_order') ->whereTime('add_time', 'week')->where('status',1)->count();
        $this->assign('weekOrderCount',$weekOrderCount);
        $monthOrderCount = Db::name('goods_order') ->whereTime('add_time', 'month')->where('status',1)->count();
        $this->assign('monthOrderCount',$monthOrderCount);
        //提现
        $cashCount = Db::name('user_cash')->where('status',0)->count();
        $this->assign('cashCount',$cashCount);
        $todayCashCount = Db::name('user_cash') ->whereTime('add_time', 'today')->where('status',0)->count();
        $this->assign('todayCashCount',$todayCashCount);
        $yesterdayCashCount = Db::name('user_cash') ->whereTime('add_time', 'yesterday')->where('status',0)->count();
        $this->assign('yesterdayCashCount',$yesterdayCashCount);
        $weekCashCount = Db::name('user_cash') ->whereTime('add_time', 'week')->where('status',0)->count();
        $this->assign('weekCashCount',$weekCashCount);
        $monthCashCount = Db::name('user_cash') ->whereTime('add_time', 'month')->where('status',0)->count();
        $this->assign('monthCashCount',$monthCashCount);

        //用户
        $userCount = Db::name('user')->count();
        $this->assign('userCount',$userCount);
        $todayUserCount = Db::name('user') ->whereTime('add_time', 'today')->count();
        $this->assign('todayUserCount',$todayUserCount);
        $yesterdayUserCount = Db::name('user') ->whereTime('add_time', 'yesterday')->count();
        $this->assign('yesterdayUserCount',$yesterdayUserCount);
        $weekUserCount = Db::name('user') ->whereTime('add_time', 'week')->count();
        $this->assign('weekUserCount',$weekUserCount);
        $monthUserCount = Db::name('user') ->whereTime('add_time', 'month')->count();
        $this->assign('monthUserCount',$monthUserCount);
        //积分订单
        $integralCount = Db::name('integral_order')->where('status',0)->count();
        $this->assign('integralCount',$integralCount);
        $todayIntegralCount = Db::name('integral_order') ->whereTime('add_time', 'today')->where('status',0)->count();
        $this->assign('todayIntegralCount',$todayIntegralCount);
        $yesterdayIntegralCount = Db::name('integral_order') ->whereTime('add_time', 'yesterday')->where('status',0)->count();
        $this->assign('yesterdayIntegralCount',$yesterdayIntegralCount);
        $weekIntegralCount = Db::name('integral_order') ->whereTime('add_time', 'week')->where('status',0)->count();
        $this->assign('weekIntegralCount',$weekIntegralCount);
        $monthIntegralCount = Db::name('integral_order') ->whereTime('add_time', 'month')->where('status',0)->count();
        $this->assign('monthIntegralCount',$monthIntegralCount);
        return view();
    }

    public function getGoodsOrderCount($type)
    {


    }
}